﻿@model IEnumerable<EagleProject.LinQDataContext.CommonSubscriberReg>

@{
    ViewBag.Title = "List Register Form";    
}

<h2>My Register Form</h2>

<table>
    <tr>
        <th>Status
        </th>
        <th>Type
        </th>
        <th>Register Name
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Gender)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.ContactAddress)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.CommencementDate)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.IssuedDate)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.ExpiryDate)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Cost)
        </th>
        <th></th>
    </tr>

    @foreach (var item in Model)
    {
        <tr>
            <td>
                @if (item.CommencementDate != null)
                {
                    <a>Processing / Activing</a>
                }
                else
                {
                    <a>Draft</a>
                }
            </td>
            <td>
                @EagleProject.Controllers.MyController.CardNameOfType(item.RegType)
            </td>
            <td>
                @item.FirstName @item.MiddleName @item.Lastname
            </td>
            <td>
                @EagleProject.Controllers.MyController.GetGender(item.Gender)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ContactAddress)
            </td>
            @if (item.CommencementDate == null)
            {
                <td colspan="3">Not Registed
                </td>
            }
            else
            {
                <td>
                    @Html.DisplayFor(modelItem => item.CommencementDate)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.IssuedDate)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.ExpiryDate)
                </td>
            }
            <td>
                @Html.DisplayFor(modelItem => item.Cost)
            </td>
            <td>
                @Html.ActionLink("Details", "ViewRegForm", "Subscriber", new { id = item.ID }, null)
                @if (item.CommencementDate == null)
                {
                    <a>|</a>
                    @Html.ActionLink("Edit", "EditRegForm", "Subscriber", new { id = item.ID }, null)
                    <a>|</a>
                    @Html.ActionLink("Delete", "DeleteRegForm", "Subscriber", new { id = item.ID }, null)
                }
            </td>
        </tr>
    }

</table>
